package com.bwsoft.admin.domain;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import javax.annotation.Generated;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.hibernate.annotations.GenericGenerator;

/**
 * 账户POJO
 * 
 * @author Cui Bowen
 */
@Entity
@Table(name = "ac_account")
public class Account implements Serializable {

	private static final long serialVersionUID = 3162906078038334908L;
	@Id
	@Column(name = "id")
	@GenericGenerator(name = "idGenerator", strategy = "identity")
	@GeneratedValue(generator = "idGenerator")
	private Integer accountId;
	private String account;
	private String password;
	private String nickName;

	private String headImgURL;
	private String phone;
	private String email;
	private String address;
	private Date birthday;
	private boolean sex;
	private String compName;
	private Integer compNature;
	@Transient
	private String compNatureName;
	private String linkMan;
	private String fax;
	private String img1;
	private String img2;
	private Boolean jinyongFlag;
	private Boolean cnasFlag;
	private String addTime;
	private String phoneOS;
	private String phoneModel;
	private String registrationID;
	private Date lastLoginTime;
	/*
	 * @ManyToOne(cascade = { CascadeType.ALL })
	 * 
	 * @JoinColumn(name = "accountType", referencedColumnName="dicKey") private
	 * DictionaryData accountType;
	 */

	private Integer accountType;
	@Transient
	private String accountTypeName;
	private Integer attestStatus;
	@Transient
	private String attestStatusName;

	// 个人账户所对应的单位
	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "compid")
	private Account company;

	// 单位下的所有个人账户
	@OneToMany(mappedBy = "company", cascade = CascadeType.ALL, fetch = FetchType.LAZY, targetEntity = Account.class)
	private List<Account> accounts = new ArrayList<Account>();

	// 参加的质量控制
	@OneToMany(mappedBy = "joinerId", cascade = CascadeType.ALL, fetch = FetchType.LAZY, targetEntity = QualityControlJoiner.class)
	private Set<QualityControlJoiner> qualityControlJoiners = new HashSet<QualityControlJoiner>();

	// 发起的质量控制
	@OneToMany(mappedBy = "sponsor", cascade = CascadeType.ALL, fetch = FetchType.LAZY, targetEntity = QualityControl.class)
	private Set<QualityControl> qualityControl = new HashSet<QualityControl>();

	// 上传的标准
	@OneToMany(mappedBy = "uploader", cascade = CascadeType.ALL, fetch = FetchType.LAZY, targetEntity = Standard.class)
	private Set<Standard> standards = new HashSet<Standard>();

	// 实验室上传的报告
	@OneToMany(mappedBy = "shangchuan", cascade = CascadeType.ALL, fetch = FetchType.LAZY, targetEntity = Report.class)
	private Set<Report> libUploadReports = new HashSet<Report>();

	// 单位的报告
	@OneToMany(mappedBy = "danwei", cascade = CascadeType.ALL, fetch = FetchType.LAZY, targetEntity = Report.class)
	private Set<Report> compReports = new HashSet<Report>();

	public Integer getAccountId() {
		return accountId;
	}

	public void setAccountId(Integer accountId) {
		this.accountId = accountId;
	}

	public String getAccount() {
		return account;
	}

	public void setAccount(String account) {
		this.account = account;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getNickName() {
		return nickName;
	}

	public void setNickName(String nickName) {
		this.nickName = nickName;
	}

	public String getHeadImgURL() {
		return headImgURL;
	}

	public void setHeadImgURL(String headImgURL) {
		this.headImgURL = headImgURL;
	}

	public String getPhone() {
		return phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public String getCompName() {
		return compName;
	}

	public void setCompName(String compName) {
		this.compName = compName;
	}

	public Integer getCompNature() {
		return compNature;
	}

	public void setCompNature(Integer compNature) {
		this.compNature = compNature;
	}

	public String getCompNatureName() {
		return compNatureName;
	}

	public void setCompNatureName(String compNatureName) {
		this.compNatureName = compNatureName;
	}

	public String getLinkMan() {
		return linkMan;
	}

	public void setLinkMan(String linkMan) {
		this.linkMan = linkMan;
	}

	public String getFax() {
		return fax;
	}

	public void setFax(String fax) {
		this.fax = fax;
	}

	public String getImg1() {
		return img1;
	}

	public void setImg1(String img1) {
		this.img1 = img1;
	}

	public String getImg2() {
		return img2;
	}

	public void setImg2(String img2) {
		this.img2 = img2;
	}

	public Boolean getCnasFlag() {
		return cnasFlag;
	}

	public void setCnasFlag(Boolean cnasFlag) {
		this.cnasFlag = cnasFlag;
	}

	public String getAddTime() {
		return addTime;
	}

	public void setAddTime(String addTime) {
		this.addTime = addTime;
	}

	public Account getCompany() {
		return company;
	}

	public void setCompany(Account company) {
		this.company = company;
	}

	public List<Account> getAccounts() {
		return accounts;
	}

	public void setAccounts(List<Account> accounts) {
		this.accounts = accounts;
	}

	public Integer getAccountType() {
		return accountType;
	}

	public void setAccountType(Integer accountType) {
		this.accountType = accountType;
	}

	public String getAccountTypeName() {
		return accountTypeName;
	}

	public void setAccountTypeName(String accountTypeName) {
		this.accountTypeName = accountTypeName;
	}

	public Integer getAttestStatus() {
		return attestStatus;
	}

	public void setAttestStatus(Integer attestStatus) {
		this.attestStatus = attestStatus;
	}

	public String getAttestStatusName() {
		return attestStatusName;
	}

	public void setAttestStatusName(String attestStatusName) {
		this.attestStatusName = attestStatusName;
	}

	public Set<QualityControlJoiner> getQualityControlJoiners() {
		return qualityControlJoiners;
	}

	public void setQualityControlJoiners(
			Set<QualityControlJoiner> qualityControlJoiners) {
		this.qualityControlJoiners = qualityControlJoiners;
	}

	public Set<QualityControl> getQualityControl() {
		return qualityControl;
	}

	public void setQualityControl(Set<QualityControl> qualityControl) {
		this.qualityControl = qualityControl;
	}

	public Set<Standard> getStandards() {
		return standards;
	}

	public void setStandards(Set<Standard> standards) {
		this.standards = standards;
	}

	public Set<Report> getLibUploadReports() {
		return libUploadReports;
	}

	public void setLibUploadReports(Set<Report> libUploadReports) {
		this.libUploadReports = libUploadReports;
	}

	public Set<Report> getCompReports() {
		return compReports;
	}

	public void setCompReports(Set<Report> compReports) {
		this.compReports = compReports;
	}

	public Date getBirthday() {
		return birthday;
	}

	public void setBirthday(Date birthday) {
		this.birthday = birthday;
	}

	public boolean getSex() {
		return sex;
	}

	public void setSex(boolean sex) {
		this.sex = sex;
	}

	public Boolean getJinyongFlag() {
		return jinyongFlag;
	}

	public void setJinyongFlag(Boolean jinyongFlag) {
		this.jinyongFlag = jinyongFlag;
	}

	public String getPhoneOS() {
		return phoneOS;
	}

	public void setPhoneOS(String phoneOS) {
		this.phoneOS = phoneOS;
	}

	public String getPhoneModel() {
		return phoneModel;
	}

	public void setPhoneModel(String phoneModel) {
		this.phoneModel = phoneModel;
	}

	public String getRegistrationID() {
		return registrationID;
	}

	public void setRegistrationID(String registrationID) {
		this.registrationID = registrationID;
	}

	public Date getLastLoginTime() {
		return lastLoginTime;
	}

	public void setLastLoginTime(Date lastLoginTime) {
		this.lastLoginTime = lastLoginTime;
	}

}
